<template>
	<el-container>
		<el-header>
			<div class="left-panel">
				<div class="left-panel-search">
					<el-input
						class="input"
						v-model.trim="reqParams.sn"
						clearable
						placeholder="输入 SN 查询"
						@keyup.enter="search1" />
					<el-button icon="el-icon-search" type="primary" @click="search2" />
				</div>
			</div>
			<div class="right-panel">
				<div class="right-panel-search"></div>
			</div>
		</el-header>
		<el-main class="nopadding">
			<scTable
				ref="tableRef"
				:api-obj="this.$API.reworkdoc.ngByPage"
				:params="reqParams"
				:column="column"
				row-key="id"
				stripe
				hideContextMenu>
				<el-table-column label="#" type="index" width="40" />
				<el-table-column align="center" fixed="right" label="操作" width="140">
					<template #default="scope">
						<el-button round type="primary" size="small" @click="open_dialog(scope.row)"
							>返工下发</el-button
						>
					</template>
				</el-table-column>
			</scTable>
		</el-main>

		<modify ref="modify" @complete="complete" />
	</el-container>
</template>

<script>
import modify from "./modify";

export default {
    components: {
        modify,
    },
    data() {
        return {
            reqParams: {
                sn: '',
            },
            column: [
                { prop: "id", label: "id", width: 100, hide: true },
                { prop: 'sn', label: 'SN', width: 160 },
                { prop: 'productCode', label: '产品编号', width: 120 },
                { prop: 'curLineCode', label: '产线编号', width: 120 },
                { prop: 'curOpCode', label: 'NG 工位编号', width: 120 },
                { prop: 'curProcCode', label: 'NG 工序编号', width: 120 },
                { prop: 'outboundTime', label: '出站时间', width: 140 },
            ],
        };
    },
    methods: {
        complete() {
            this.$refs.tableRef.refresh();
        },
        search1() {
            this.$refs.tableRef.refresh();
            this.reqParams.sn = '';
        },
        search2() {
            this.$refs.tableRef.refresh();
        },
        open_dialog(row) {
            this.$refs.modify.open(row);
        }
    },
};
</script>
